#!/usr/bin/env python
# -*- coding:utf-8 -*-
#/home/zc/workspace/tinyfeet/trunk/src/controllers/utils/logger.py
'''
Created on 2012-4-4

@author: zc
'''
import logging
import sys
from config.settings import LOGFILENAME as logfilename

def logger():
    sys.stderr = open( logfilename , 'a' )
    logger = logging.getLogger()
    hdlr = logging.FileHandler( logfilename , mode = 'a' )
    formatter = logging.Formatter( "%(asctime)s %(levelname)s model:%(module)s pid:%(process)d %(message)s" )
    hdlr.setFormatter( formatter )
    logger.addHandler( hdlr )
    logger.setLevel( logging.DEBUG )
    return logger
